(function (factory) {
    if (typeof define === 'function' && define.amd) {
        define(['jquery'], factory);
    } else {
        factory(jQuery);
    }
}(function ($) {
    var fns;

    fns = {

        init: function () {
            this.setFilter();
        },

        setFilter: function () {

            $('.ipt-filter-opt').each(function(){

                var self       = $(this),
                    label      = self.next(),
                    label_text = label.text();

                label.remove();

                self.iCheck({
                    checkboxClass: 'icheckbox_line-blue',
                    radioClass: 'iradio_line-blue',
                    insert: label_text
                });

            });

            $('.bo-select-all').on('click', function (e) {
                e.preventDefault();
                e.stopPropagation();
                $(this).closest('li').find('.ipt-filter-opt').iCheck('check');
            });

        }

    };

    $(fns.init());
}));
